<?php

/*

  Action – Duration	$2

  +1 Action
  Now and at the start of your next turn: +$1.
  While this is in play, when another player plays an Attack card, it doesn’t affect you.

 */

class Lighthouse extends Card implements iAction, iKingdom, iDuration, iSeaside, iReactingCard {

    private $reactConditions;

    public function __construct() {
        parent::__construct("Lighthouse", 2);
        $this->duration = 1;
        $this->undoPlay = false;
        $this->undoBuy = true;

        $this->reactConditions = new ReactionConditions();
        $this->reactConditions->action = array(Attack);
        $this->reactConditions->actor = array(SomeoneElse);
        $this->reactConditions->cardLocation = array(DurationPileCards, PlayArea);
        $this->reactConditions->isDefence = true;
        $this->reactConditions->isEmptyReaction = true;
        $this->reactConditions->limit = null;
    }

    public function getDescription() {
        return array(
            "+1 Action",
            " Now and at the start of your next turn: +$1.",
            "While this is in play, when another player plays an Attack card, it doesn’t affect you.");
    }

    public function play(Game $game, $isRealCard) {
        $game->addActions(1);
        $game->addMoney(new Price(1));
        ScreenDisplay::addScreenMessage($game, true, "get +1 action and  +1$", "gets +1 action and +1$");

        $game->pushCardToDurationAffects($this, 1, $isRealCard);
        $game->cardActionFinished();
        return true;
    }

    public function cleanup(Game $game) {
        $game->moveCardFromPileToPile($this, PlayArea, DurationPileCards);
    }

    public function startTurn(Game $game, $quantity) {
        $game->addMoney(new Price(1));
        ScreenDisplay::addScreenMessage($game, true, "activate " . nicePrint($this) . " and get  +1$", "activates " . ScreenDisplay::$LMSG . " and get +1$");
        if ($quantity > 0)
            return RETURN_DURATION_TO_DISCARD;
        else
            return DELETE_VIRTUAL_DURATION_CARD;
    }

//    public function react(Game $game, $name) {
//        
//    }

    public function getConditions() {
        return $this->reactConditions;
    }

    public function isReactRelevant(Game $game, $card, $name) {
        return true;
    }

    public function react(Game $game, $card, $name) {
        ScreenDisplay::addScreenMessage($game, true, "have lighthouse in play", "has lighthouse in play", $name);
        return true;
    }

}

?>